﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HidesaburoDotNET.Core.Detecctors
{
    public class DaisusiDetector : YakuDetector
    {
        public override Yaku CheckYaku(AgariTehai agariTehai)
        {
            int[] n = new int[4];
            for (int i = 0; i < 4; i++)
            {
                n[i] = 0;
            }
            foreach (Hai h in agariTehai.Hai)
            {
                if (h.Type == HaiType.Jihai)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (h.Number == i + 1)
                        {
                            n[i]++;
                        }
                    }
                }
            }
            for (int i = 0; i < 4; i++)
            {
                if (n[i] < 3)
                {
                    return new Yaku();
                }
            }
            return new Yaku(13, "ダイスーシー");
        }
    }
}
